package com.test.learnopenglandroid.chapter2lighting;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.test.learnopenglandroid.UIHelper;

public class Chapter2 {
    public static void init(LinearLayout chapterRoot, final LinearLayout buttonRoot, FrameLayout renderRoot){
        final LinearLayout btnRoot = buttonRoot;
        final FrameLayout frenderRoot = renderRoot;
        UIHelper.addTest(chapterRoot,"第二章 光照",new View.OnClickListener(){

            @Override
            public void onClick(View view) {
                btnRoot.removeAllViews();
                addAllTest(btnRoot,frenderRoot);
            }
        });
    }

    static private void addAllTest(LinearLayout buttonRoot,FrameLayout renderRoot){
        UIHelper.addTest(buttonRoot,"环境光照",new Test1BasicLighting(renderRoot.getContext(),renderRoot, Test1BasicLighting.TestType.GLES20RendererLightAmbient));
        UIHelper.addTest(buttonRoot,"漫反射光照",new Test1BasicLighting(renderRoot.getContext(),renderRoot, Test1BasicLighting.TestType.GLES20RendererLightDiffuse));
        UIHelper.addTest(buttonRoot,"镜面光照",new Test1BasicLighting(renderRoot.getContext(),renderRoot, Test1BasicLighting.TestType.GLES20RendererLightSpecullar));
        UIHelper.addTest(buttonRoot,"基础光照 光源位置变化",new Test1BasicLighting(renderRoot.getContext(),renderRoot, Test1BasicLighting.TestType.GLES20RendererLightExercise1));
        UIHelper.addTest(buttonRoot,"材质",new Test2Material(renderRoot.getContext(),renderRoot, Test2Material.TestType.GLES20RendererMaterial));
        UIHelper.addTest(buttonRoot,"材质+光照",new Test2Material(renderRoot.getContext(),renderRoot, Test2Material.TestType.GLES20RendererMaterialLight));
        UIHelper.addTest(buttonRoot,"材质 不同光照",new Test2Material(renderRoot.getContext(),renderRoot, Test2Material.TestType.GLES20RendererDifferentLightColors));
        UIHelper.addTest(buttonRoot,"光照贴图 漫反射贴图",new Test3LightingMaps(renderRoot.getContext(),renderRoot, Test3LightingMaps.TestType.GLES20RendererLightingMaps));
        UIHelper.addTest(buttonRoot,"光照贴图 漫反射+镜面光贴图",new Test3LightingMaps(renderRoot.getContext(),renderRoot, Test3LightingMaps.TestType.GLES20RendererSpecularMap));
        UIHelper.addTest(buttonRoot,"光照贴图练习1 改变参数",new Test3LightingMaps(renderRoot.getContext(),renderRoot, Test3LightingMaps.TestType.GLES20RendererLightingMapsChangeLight));
        UIHelper.addTest(buttonRoot,"光照贴图练习4 放射光贴图",new Test3LightingMaps(renderRoot.getContext(),renderRoot, Test3LightingMaps.TestType.GLES20RendererEmissionMap));

        UIHelper.addTest(buttonRoot,"投光物 平行光",new Test4LightCasters(renderRoot.getContext(),renderRoot, Test4LightCasters.TestType.GLES20RendererLightCasterDirectional));
        UIHelper.addTest(buttonRoot,"投光物 点光",new Test4LightCasters(renderRoot.getContext(),renderRoot, Test4LightCasters.TestType.GLES20RendererLightCasterPoint));
        UIHelper.addTest(buttonRoot,"投光物 手电筒",new Test4LightCasters(renderRoot.getContext(),renderRoot, Test4LightCasters.TestType.GLES20RendererLightCasterSport));
        UIHelper.addTest(buttonRoot,"多光源",new Test4LightCasters(renderRoot.getContext(),renderRoot, Test4LightCasters.TestType.GLES20RendererMultipleLights));
    }
}
